package com.you.concurrent.volatitle;

public class VolatitleDemo {

    static volatile boolean isStop = false;

    static long num = 0;

    public static void main(String[] args) throws InterruptedException {
        new Thread(() -> {
            while (!isStop) {
                num++;
            }
        }).start();
        Thread.sleep(100L);
        isStop = true;
        System.out.println("num = " + num);
    }

}
